<?php
require_once (APPLICATION_DIR."/library/external/XOAD/xoad.php");
class LoginController extends DRX_Controller
{
	
	function xoadGetMeta()
	{
		XOAD_Client::mapMethods($this,array("login"));
	}
	
	function indexAction()
	{						
		session_destroy();
		$smarty = DRX::load("smarty");
				
		if (XOAD_Server::runServer()) {
			exit;
		}
		
		$smarty->assign("xoad_header", XOAD_Utilities::header(APPLICATION_URL."library/external/XOAD"));
		$smarty->assign("xoad_handler", XOAD_Client::register($this));
		
		$smarty->display("login/login.tpl");
	}
	
	function login($args)
	{
		session_start();
		$result = array();
				
		$form 	  = $args['form']; 
		$email 	  = $form['email_login'];
		$password = $form['password_login'];
		
		if ($email != "solvay")
			return _MSG_EMAIL_WRONG;
		if ($password != "iomedia")
			return _MSG_PASSWORD_WRONG;

		$_SESSION["account"] = true;
		return _MSG_LOGIN_SUCCESSFULLY;
	}
}
?>
